
#include <iostream>
#include <vector>
#include "arguments/arguments.h"
#include "Ls_file/Lsfile.h"
#include "synchronizator/synchronizator.h"
#include "config/config.h"
#include "compare/compare.h"
#include "Ls_file/List/List.h"

using namespace std;
namespace fs = boost::filesystem;

int main(int argc, const char* argv[]) {
	if (argc == 1) {
		cout << "You should use some arguments...\nUse --help for more information" << endl;
	} else {
		Arguments ProgramArgs(argc, argv);
		ProgramArgs.option();
		Config::getInstance(ProgramArgs.getWhatOption(), ProgramArgs.getArguments()).create_config();
		if(ProgramArgs.getWhatOption()==1 || ProgramArgs.getWhatOption()==2){
			Lsfile Ls(ProgramArgs.getFrompath(), ProgramArgs.getTopath());
			if(Ls.ispath()){
				Ls.createAll_ls(".from_ls",".to_ls");
				Compare cmp(&Ls, Config::getInstance(ProgramArgs.getWhatOption(), ProgramArgs.getArguments()).getConfigList());
				cmp.do_all();
				Synchronizator::getInstance().synchronize(ProgramArgs.getFrompath(), ProgramArgs.getTopath(), &cmp);
			}
		}
		else if(ProgramArgs.getWhatOption()==11){
			List Ls(ProgramArgs.getListname(), ProgramArgs.getListpath());
			if(Ls.ispath()){
				Ls.createlist();
			}
		}
	}
	return 0;
}
